﻿using Comm100.Framework.Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bot.Domain.Entities;
using Bot.Domain.Interfaces;
using Bot.Domain.Bo;
using Castle.Windsor;

namespace Bot.Domain.Categories.Service
{
    public class PackageDomainService : IPackageDomainService
    {
        private IWindsorContainer _container;
        private readonly IRepository<Guid, Package> _repository;

        public PackageDomainService(IRepository<Guid, Package> repository, IWindsorContainer container)
        {
            this._repository = repository;
            this._container = container;
        }

        public Package Create(Package category)
        {
            return _repository.Create(category);
        }

        public Package Get(Guid id)
        {
            return _repository.Get(id);
        }

        public Package Update(PackageUpdateBo bo)
        {
            Package package = _repository.Get(bo.Id);
            package.Id = bo.Id;
            package.MessageQuataPerMonth = bo.MessageQuataPerMonth;
            package.MonthlyListPrice = bo.MonthlyListPrice;
            package.QuarterlyListPrice = bo.QuarterlyListPrice;
            package.YearlyListPrice = bo.YearlyListPrice;

            _repository.Update(package);

            return package;

        }

        public IEnumerable<Package> List()
        {
            return _repository.ListAll();
        }

        public void Delete(Guid id)
        {
            Package package = _repository.Get(id);

            _repository.Delete(package);

        }
    }
}
